import { FilterConst } from "../../../../component/gconst/FilterConst";
import { DialogInfo } from "../../../model/dialog/DialogInfo";
import { ETaskStatus } from "../../../../../Message/Game/ETaskStatus";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { DialogOperate } from "../../../rules/DialogOperate";
import { TaskConfig } from "../../../resource/TaskConfig";
//class TaskNameLabel
    
    export  class TaskNameLabel /* flash.display.Sprite */
    {
        constructor()
        {
            
            this._icon = new Object /* flash.display.Bitmap */();
            addChild(this._icon);
            this._nameLabel = new Object /* flash.text.TextField */();
            this._nameLabel.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._nameLabel.selectable = false;
            this._nameLabel.mouseEnabled = false;
            this._nameLabel.textColor = 16580298;
            this._nameLabel.x = 16;
            this._nameLabel.filters = [FilterConst.nameGlowFilter];
            addChild(this._nameLabel);
            this.buttonMode = true;
            return;
        }

        public get dialog(): DialogInfo
        {
            return this._dialog;
        }

        public updateData(arg1: DialogInfo): void
        {
            var loc1=null;
            this._dialog = arg1;
            var loc2=arg1.status;
            switch (loc2) 
            {
                case ETaskStatus._ETaskStatusCanGet:
                {
                    loc1 = GlobalClass.getBitmapData(ImagesConst.AcceptIcon);
                    break;
                }
                case ETaskStatus._ETaskStatusHadCompleted: case ETaskStatus._ETaskStatusHadFail:
                {
                    loc1 = GlobalClass.getBitmapData(ImagesConst.CompletedIcon);
                    break;
                }
                case ETaskStatus._ETaskStatusNotCompleted:
                {
                    if (arg1.operateId != DialogOperate.DoTask) 
                    {
                        loc1 = GlobalClass.getBitmapData(ImagesConst.UnCompletedIcon);
                    }
                    else 
                    {
                        loc1 = GlobalClass.getBitmapData(ImagesConst.UnCompletedIcon);
                    }
                    break;
                }
            }
            this._icon.bitmapData = loc1;
            this._nameLabel.htmlText = arg1.group + TaskConfig.instance.getTaskName(arg1.sTask.code) + arg1.isCompleted;
            return;
        }

        public dispose(): void
        {
            return;
        }

        /* internal */ /* var */_icon: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_nameLabel: Object /* flash.text.TextField */;

        /* internal */ /* var */_dialog: DialogInfo;
    }
